package
{
	import mx.collections.ArrayCollection;
	import mx.utils.ObjectUtil;
	
	import smashedapples.vo.DebugVO;

	
	public class Debug
	{
		
		
		[Bindable]
		public static var collection : ArrayCollection = new ArrayCollection();
		
		
		public static function push(source:*,output:*,showTrace:Boolean = false):void
		{	
			
			var vo : DebugVO;
			if( source is String )
			{
				vo = new DebugVO( { name:source, output:ObjectUtil.toString(output) } );
			}
			else
			{
				var info : * = ObjectUtil.getClassInfo( source );
				vo = new DebugVO( { name:info["name"], output:ObjectUtil.toString(output) } );
			}
			
			if( showTrace )
				trace( ObjectUtil.toString( output ) );
			
			
			Debug.collection.addItem( vo );
		}
		
		public static function clear():void
		{
			Debug.collection = new ArrayCollection();
		}
		

	}
}